package com.three.service.impl;

import com.three.dao.UserDao;
import com.three.dao.impl.UserDaoImpl;
import com.three.pojo.User;
import com.three.service.UserService;

/**
 * @author wzm
 * @create 2023-11-07 16:51
 * project_name:web2310
 * @Description
 */
//业务逻辑层的具体实现类
public class UserServiceImpl implements UserService {

   private UserDao userDao = new UserDaoImpl();

    @Override
    public boolean register(User user) {
        //调用dao层的insert方法并判断是否新增成功
        return userDao.insert(user) > 0;
    }

    //login功能的具体实现
    @Override
    public User login(User user) {
        return userDao.selectByUserNameAndPassWord(user);
    }

    @Override
    public boolean existsName(String username) {
        return userDao.selectExistsName(username) == null;
    }
}
